<template>
  <div class="fdata">
    <div class="table">
      <n-data-table :columns="columns" :data="data" />
    </div>
  </div>
</template>

<script setup lang="ts">
import { computed } from 'vue';
const props = defineProps({
  fdata: {
    type: Array,
    default: [],
  },
});
console.log('props.fdata', props.fdata);
const columns=
[
  {
    title: '编号',
    key: 'index',
  },
  {
    title: '作答数据',
    key: 'value',
  },
];

const data = computed(() => {
    let array = [];
    for (let i = 0; i < props.fdata.length; i++) {
      array.push({
        index: i+1,
        value: props.fdata[i],
      });
    }
    return array;
});
</script>

<style scoped lang="scss">
.fdata {
  height: 50vh;
  width: 55vw;
  div {
    height: 50vh;
    width: 55vw;
  }
}
</style>
